<template>
    <div class="newsinfo-container">

        <h3 class="title"> {{message.title}} </h3>

        <div class="subtitle">
            <span>{{message.subtitle}} </span>
            <span>点击：{{message.click}}</span>
        </div>

        <div style="padding: 20px 0">
            <hr>
        </div>

        <div class="content" v-html="message.contentMessage"></div>

        <comment-info :id="this.id"></comment-info>
    </div>
</template>

<script>
    import {Toast} from 'mint-ui'
    import CommentInfo from '../subComponents/commentInfo.vue'

    export default {
        data:function(){
            return {
                "id": this.$route.params.id,
                message:[]
            }
        },
        created(){
          this.getDataInfo();
        },
        methods:{
            getDataInfo(){
                this.$http.get('http://rap2api.taobao.org/app/mock/149003/home/newsinfo?id=' + this.id)
                    .then((resultData)=>{
                        var result = resultData.body;
                        if (parseInt(result.status) === 200) {
                            var list = result.message;
                            this.message = list[0];
                        }else {
                            Toast('请求失败')
                        }
                    })
            }
        },
        components:{
            CommentInfo
        }
    }
</script>

<style>
    .newsinfo-container {
        padding: 0 4px;
    }
    .newsinfo-container .title {
        margin: 15px 0;
        font-size: 16px;
        color: red;
        text-align: center;
    }

    .newsinfo-container .subtitle {
        display: flex;
        justify-content: space-between;
        font-size: 13px;
        color: #4cd964;
    }
    .newsinfo-container .content img {
        width: 100%;
    }
</style>